home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / FREENET / MELL / NETLIB00 / !NetLib / sys / h / time < prev    next >
Encoding:
Text File  |  1997-04-20  |  1.6 KB  |  64 lines

  1. #ifndef __sys_time_h
  2. #define __sys_time_h
  3.  
  4. /* Freenet programmers library - sys/time.h - 23/5/95 */
  5.  
  6. #ifndef __sys_types_h
  7. #include "Internet:sys.h.types"
  8. #endif
  9.  
  10. /*
  11.  * Structure defining a time of day
  12.  */
  13. struct timeval {
  14.   long tv_sec;         /* Seconds past midnight */
  15.   long tv_usec;        /* Microseconds within the current second */
  16. };
  17.  
  18. /*
  19.  * Structure defining a timezone
  20.  */
  21. struct timezone {
  22.   int tz_minuteswest;  /* Minutes west of Greenwich */
  23.   int tz_dsttime;      /* Type of DST in use */
  24. };
  25.  
  26. /*
  27.  * Type of DST recognised
  28.  */
  29. #define DST_NONE    0  /* Not on DST */
  30. #define DST_USA     1  /* USA style DST */
  31. #define DST_AUST    2  /* Australian style DST */
  32. #define DST_WET     3  /* Western European DST */
  33. #define DST_MET     4  /* Middle European DST */
  34. #define DST_EET     5  /* Eastern European DST */
  35. #define DST_CAN     6  /* Canada */
  36. #define DST_GB      7  /* Great Britain and Eire */
  37. #define DST_RUM     8  /* Rumania */
  38. #define DST_TUR     9  /* Turkey */
  39. #define DST_AUSTALT 10 /* Australian style with shift in 1986 */
  40.  
  41. /*
  42.  * Is a timeval structure set?
  43.  */
  44. #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
  45.  
  46. /*
  47.  * Compare two timeval structures (doesn't work for <= or >= ops)
  48.  */
  49. #define timercmp(tvp, uvp, cmp) \
  50.           ((tvp)->tv_sec cmp (uvp)->tv_sec || \
  51.            (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
  52.  
  53. /*
  54.  * Clear a timeval structure
  55.  */
  56. #define timerclear(tvp) (void)((tvp)->tv_sec = (tvp)->tv_usec = 0)
  57.  
  58. /*
  59.  * Get the time of day
  60.  */
  61. extern void gettimeofday(struct timeval */*tv*/, struct timezone */*tz*/);
  62.  
  63. #endif
  64.